package com.homegoods.shoppingcar.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.homegoods.shoppingcar.item.ShoppingCartItem;
import com.kedll.library.adapter.MultiTypeAdapter;
import com.kedll.library.mvp.BaseModel;

import java.util.ArrayList;

/**
 * 购物车的数据结构，非通用，根据自己需要修改
 * <p/>
 * Created by 绯若虚无（@link https://github.com/joefei） on 2015/10/12.
 */
public class ShoppingCartBean extends BaseModel<ShoppingCartItem>  {
    /**
     * {
     * 			"sjName": "山东新丝路工贸股份有限公司",
     * 			"sjImg": "/upath/2019/1/14/11218598357552ufi.png",
     * 			"sjSid": "qVyes9%2b5sLd9THh9vPLJqG8iR3cXcDPfl29Q9SzGi6Cc5xeboG0xNempvxmDAkC5",
     * 			"SPList": [{
     *                        }]        * 		}
     */
    /**
     * 失效
     */
    public static final String GOOD_INVALID = "0";

    public static final String GOOD_VALID = "1";

    /**
     * 购物车商品数量
     */
    public static final String KEY_NUM = "num";
    /**
     * 购物车规格ID
     */
    public static final String KEY_PRODUCT_ID = "product_id";

    /**
     * 是否处于编辑状态
     */
    private boolean isEditing;
    /**
     * 组是否被选中
     */
    private boolean isGroupSelected;

    /**
     * 店铺名称
     */
    @JSONField(alternateNames = {"sjName"})
    private String merchantName;

    private String sjImg;
    /**
     * 店铺ID
     */
    @JSONField(alternateNames = {"sjSid"})
    private String merID;

    /**
     * 是否失效列表
     */
    private boolean isInvalidList;

    private boolean isAllGoodsInvalid;

    @JSONField(alternateNames = {"SPList"})
    private ArrayList<GoodsBean> goods;

    private ArrayList<Dispatch> dispatch;

    private int groupItemPosition;

    public int getGroupItemPosition() {
        return groupItemPosition;
    }

    public void setGroupItemPosition(int groupItemPosition) {
        this.groupItemPosition = groupItemPosition;
    }

    public boolean isAllGoodsInvalid() {
        return isAllGoodsInvalid;
    }

    public void setIsAllGoodsInvalid(boolean isAllGoodsInvalid) {
        this.isAllGoodsInvalid = isAllGoodsInvalid;
    }

    public boolean isInvalidList() {
        return isInvalidList;
    }

    public void setIsInvalidList(boolean isInvalidList) {
        this.isInvalidList = isInvalidList;
    }

    public String getMerID() {
        return merID;
    }

    public void setMerID(String merID) {
        this.merID = merID;
    }

    public boolean isEditing() {
        return isEditing;
    }

    public boolean isGroupSelected() {
        return isGroupSelected;
    }

    public void setIsGroupSelected(boolean isGroupSelected) {
        this.isGroupSelected = isGroupSelected;
    }

    public ArrayList<GoodsBean> getGoods() {
        return goods;
    }

    public void setGoods(ArrayList<GoodsBean> goods) {
        this.goods = goods;
    }

    public ArrayList<Dispatch> getDispatch() {
        return dispatch;
    }

    public void setDispatch(ArrayList<Dispatch> dispatch) {
        this.dispatch = dispatch;
    }

    public String getMerchantName() {
        return merchantName;
    }

    public void setMerchantName(String merchantName) {
        this.merchantName = merchantName;
    }

    public void setIsEditing(boolean isEditing) {
        this.isEditing = isEditing;
    }

    public String getSjImg() {
        return sjImg;
    }

    public void setSjImg(String sjImg) {
        this.sjImg = sjImg;
    }

    @Override
    public ShoppingCartItem createItem(MultiTypeAdapter adapter) {
        if (item == null) {
            item = new ShoppingCartItem(this, adapter);
        }
        return item;
    }
}
